package com.olympus.hermes.order.constants;

import com.olympus.hermes.common.constants.BaseEnum;
import com.olympus.hermes.common.constants.EnumConverter;

import java.util.Optional;

/**
 * @author Mickey
 * @since 2021/2/19
 */
public enum SourceType implements BaseEnum<SourceType> {

    /**
     *
     */

    PC(1,"pc"),
    APP(2,"app"),

    ;

    private final Integer code;
    private final String msg;

    SourceType(Integer code, String msg){
        this.code = code;
        this.msg = msg;
    }

    @Override
    public Integer getCode() {
        return this.code;
    }

    @Override
    public String getName() {
        return this.msg;
    }

    public static Optional<SourceType> of(Integer code) {
        return Optional.ofNullable(BaseEnum.parseByCode(SourceType.class,code));
    }

    public static class Converter extends EnumConverter<SourceType> {

    }
}
